package July;

import com.sun.org.apache.xml.internal.security.utils.HelperNodeList;

import java.util.HashMap;
import java.util.Scanner;

public class Day0728 {
    //计算某字符出现的次数
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        char ch = scanner.next().charAt(0);
        char ch1 = Character.toLowerCase(ch);
        str = str.toLowerCase();

        HashMap<Character,Integer> hashMap = new HashMap<>();
        for (int i = 0; i < str.length(); i++) {
            if (hashMap.containsKey(str.charAt(i))){
                hashMap.put(str.charAt(i),hashMap.get(str.charAt(i))+1);
            }else {
                hashMap.put(str.charAt(i),1);
            }
        }

        if (hashMap.containsKey(ch1)){
            System.out.println(hashMap.get(ch1));
        }else
            System.out.println(0);
    }

    //杨辉三角的变形
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int res = 0;
        if ( n <= 2)
            res = -1;
        else if (n % 2 == 1)
            res = 2;
        else
            res = n / 2 % 2 + 3;

        System.out.println(res);
    }
}
